package com.app.backend.activiti.entity;

import com.app.backend.common.base.BaseEntity;
import com.app.backend.common.constant.ActConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @program: ActBiz
 * @description:
 * @author: Zhun.Xiao
 * @create: 2020-02-27 10:15
 **/


@Data
@Entity
@Table(name = "sys_act_biz")
@ApiModel(value = "业务申请")
public class ActBiz extends BaseEntity {
    //todo

    @ApiModelProperty(value = "申请标题")
    private String title;

    @ApiModelProperty(value = "创建用户id")
    private String userId;

    @ApiModelProperty(value = "关联表id")
    private String tableId;

    @ApiModelProperty(value = "流程定义id")
    private String procDefId;

    @ApiModelProperty(value = "流程实例id")
    private String procInstId;

    @ApiModelProperty(value = "状态 0草稿默认 1处理中 2结束")
    private Integer status = ActConstant.STATUS_TO_APPLY;

    @ApiModelProperty(value = "结果状态 0未提交默认 1处理中 2通过 3驳回")
    private Integer result = ActConstant.RESULT_TO_SUBMIT;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "提交申请时间")
    private Date applyTime;

    @ApiModelProperty(value = "历史标记")
    private Boolean isHistory;

    @Transient
    @ApiModelProperty(value = "分配用户id")
    private String[] assignees;

    @Transient
    @ApiModelProperty(value = "所属流程名")
    private String processName;

    @Transient
    @ApiModelProperty(value = "前端路由名")
    private String routeName;

    @Transient
    @ApiModelProperty(value = "任务优先级 默认0")
    private Integer priority = 0;

    @Transient
    @ApiModelProperty(value = "当前任务")
    private String currTaskName;

    @Transient
    @ApiModelProperty(value = "第一个节点是否为网关")
    private Boolean firstGateway = false;

    @Transient
    @ApiModelProperty(value = "是否发送站内消息")
    private Boolean sendMessage;

    @Transient
    @ApiModelProperty(value = "是否发送邮件通知")
    private Boolean sendEmail;

    @Transient
    @ApiModelProperty(value = "流程设置参数")
    private Map<String, Object> params = new HashMap<>(16);

}